/**
 * Created by 杨 on 2017-07-23.
 */

/**
 * 信息展示
 * @param content
 */
var messager = null;
var csrfParameter = $("meta[name='_csrf_parameter']").attr("content");
var csrfHeader = $("meta[name='_csrf_header']").attr("content");
var csrfToken = $("meta[name='_csrf']").attr("content");
var headers = {};
headers[csrfHeader] = csrfToken;
function showMessage(content, type) {
    if (messager == null) {
        Messenger.options = {
            extraClasses: 'messenger-fixed messenger-on-bottom messenger-on-right',
            theme: 'block'
        }
        messager = Messenger().post({
            showCloseButton: true,
            type: type || "info",
            hideAfter: 3,
            message: content
        });
    } else {
        messager.update({
            type: type || "info",
            message: content
        });
    }
}

$(function () {
    $.ajaxSetup({
        headers: headers,
        error: function (jqXHR, textStatus, errorThrown) {
            showMessage(errorThrown, "error");
        }
    });
})